package yl.hs.bmipfull.service.laboratory.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import yl.hs.bmipfull.daos.laboratory.ITaskConfigDao;
import yl.hs.bmipfull.daos.laboratory.ITaskConfigDetailsDao;
import yl.hs.bmipfull.pojo.laboratory.TaskConfigDetailsEntity;
import yl.hs.bmipfull.pojo.laboratory.TaskConfigEntity;
import yl.hs.bmipfull.service.laboratory.ITaskConfigDetailsService;

import java.util.List;

/**
 * 生产任务配比明细信息 服务层实现
 *
 * @author 张凯 on 2021/6/18 <br/>
 */
@Service
public class TaskConfigDetailsServiceImpl extends LaboratoryBaseService implements ITaskConfigDetailsService {

    @Autowired
    ITaskConfigDetailsDao configDetailsDao;

    @Autowired
    ITaskConfigDao taskConfigDao;

    @Override
    public List<TaskConfigDetailsEntity> queryByTaskConfigSn(String taskConfigSn) {
        return configDetailsDao.queryByTaskConfigSn(taskConfigSn);
    }

    @Override
    public List<TaskConfigDetailsEntity> queryByTaskSn(String taskSn,String lineSn) {
        TaskConfigEntity taskConfigEntity = taskConfigDao.queryConfigByTaskSNAndProductLine(taskSn, lineSn);
        if (taskConfigEntity != null) {
            return configDetailsDao.queryByTaskConfigSn(taskConfigEntity.getSn());
        }
        else {
            return  null;
        }
    }
}
